<template>
<div class="c-panel login">

<el-form :inline="true" :model="formInline" class="demo-form-inline">
  <el-form-item label="项目名称">
    <el-input v-model="formInline.hname" placeholder="项目名称"></el-input>
  </el-form-item>
  
  <el-form-item label="所属公司">
   <el-select v-model="formInline.company.cid" value-key="cid">
     <el-option v-for="(item, index) in formInline.company" :label="item.cname" :value="item.cid" :key="index"></el-option>
   </el-select>
</el-form-item>

  <el-form-item label="土地用途">
   <el-select v-model="formInline.landuse.lid" value-key="lid">
     <el-option v-for="(item, index) in formInline.landuse" :label="item.lname" :value="item.lid" :key="index"></el-option>
   </el-select>
</el-form-item>
<el-form-item label="建筑区划">
   <el-select v-model="formInline.buildingarea.bid" value-key="bid">
     <el-option v-for="(item, index) in formInline.buildingarea" :label="item.bname" :value="item.bid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="土地权属">
   <el-select v-model="formInline.landowner.oid" value-key="oid">
     <el-option v-for="(item, index) in formInline.landowner" :label="item.oname" :value="item.oid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="房屋性质">
   <el-select v-model="formInline.roomtype.rid" value-key="rid">
     <el-option v-for="(item, index) in formInline.roomtype" :label="item.rname" :value="item.rid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="设计用途">
   <el-select v-model="formInline.designpurpose.did" value-key="did">
     <el-option v-for="(item, index) in formInline.designpurpose" :label="item.dname" :value="item.did" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="土地证号">
   <el-select v-model="formInline.landnumber.lnid" value-key="lnid">
     <el-option v-for="(item, index) in formInline.landnumber" :label="item.lnname" :value="item.lnid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="房屋结构">
   <el-select v-model="formInline.struct.bsid" value-key="bsid">
     <el-option v-for="(item, index) in formInline.struct" :label="item.bsname" :value="item.bsid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="取得方式">
   <el-select v-model="formInline.Method.gid" value-key="gid">
     <el-option v-for="(item, index) in formInline.Method" :label="item.gname" :value="item.gid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="楼盘状态">
   <el-select v-model="formInline.status.housestatusid" value-key="housestatusid">
     <el-option v-for="(item, index) in formInline.status" :label="item.housestatus" :value="item.housestatusid" :key="index"></el-option>
   </el-select>
</el-form-item>

<el-form-item label="所属区">
   <el-select v-model="formInline.areas.areaid" value-key="areaid">
     <el-option v-for="(item, index) in formInline.areas" :label="item.area" :value="item.areaid" :key="index"></el-option>
   </el-select>
</el-form-item>

 <el-form-item label="房屋坐落">
    <el-input v-model="formInline.location" placeholder="项目名称"></el-input>
  </el-form-item>
<br>
  <el-form-item>
    <el-button type="primary" @click="onSubmit">添加楼盘</el-button>
  </el-form-item>
</el-form>
</div>
</template>
<script>
export default{
    name:"addHouse",
    data () {
        return {
            formInline:{
                //状态
                status:"",
                //公司
                company:"",
                //土地用途
                landuse:"",
                //土地权属
                landowner:"",
                //土地证号
                landnumber:"",
                //设计用途
                designpurpose:"",
                //楼盘状态
            
                //取得方式
                Method:"",
                //房屋结构
                struct:"",
                //房屋性质
                roomtype:"",
                //所属区
                areas:"",
                location:"",
                //项目名称
                hname:"",
                cid:"" ,
                buildingarea:""
            }
        }
    },
    mounted () {
        //展示所有公司
        this.showAllCompany();
        //展示所有土地用途
        this.showAllLanduse();
        //展示所有土地权属
        this.showAllLandOwnership();
        //展示所有设计用途
        this.showAllDesignpurpose();
        //展示所有建筑区划
        this.showAllBuildarea();
        //展示土地证号
        this.showLandnumber();
        //展示房屋结构
        this.showStruct();
        //展示所有取得方式
        this.showMethod();
        //展示所有楼盘状态
        this.showStatus();
        //展示所有房屋性质；
        this.showAllRoomtype();
        this.showAllArea();
    },
    methods:{
          //展示所有公司
        showAllCompany(){
              var the = this;
            this.sa.ajax("/total/findAllCompany",
           null,
            function(data){
                the.formInline.company = data.data;
            }.bind(this)
            )
        },
        //展示所有土地用途
        showAllLanduse(){
                 var the = this;
            this.sa.ajax("/total/findAllLandUse",
           null,
            function(data){
                the.formInline.landuse = data.data;
            }.bind(this)
            )
        },
        //展示所有土地权属
        showAllLandOwnership(){
                 var the = this;
            this.sa.ajax("/total/findAllLandOwner",
           null,
            function(data){
                the.formInline.landowner = data.data;
            }.bind(this)
            )
        },
        //展示所有设计用途
        showAllDesignpurpose(){
             var the = this;
            this.sa.ajax("/total/findAllDesign",
           null,
            function(data){
                the.formInline.designpurpose = data.data;
            }.bind(this)
            )
        },
        //展示所有建筑区划
        showAllBuildarea(){
           var the = this;
            this.sa.ajax("/total/findAllbuildingare",
           null,
            function(data){
                the.formInline.buildingarea = data.data;
            }.bind(this)
            )
        },
        //展示土地证号
        showLandnumber(){
            var the = this;
            this.sa.ajax("/total/findAllLandNumber",
           null,
            function(data){
                the.formInline.landnumber = data.data;
            }.bind(this)
            )
        },
        //展示房屋结构
        showStruct(){
             var the = this;
            this.sa.ajax("/total/findAllStruct",
           null,
            function(data){
                the.formInline.struct = data.data;
            }.bind(this)
            )
        },
        //展示所有取得方式
        showMethod(){
                 var the = this;
            this.sa.ajax("/total/findAllMethod",
           null,
            function(data){
                the.formInline.Method = data.data;
            }.bind(this))
        },
        //展示所有楼盘状态
        showStatus(){
               var the = this;
            this.sa.ajax("/buildManager/getAllHouseStatus",
           null,
            function(data){
                the.formInline.status = data.data;
            }.bind(this)
            )
        },
        showAllRoomtype(){
               var the = this;
            this.sa.ajax("/total/findAllRoomtype",
           null,
            function(data){
                the.formInline.roomtype = data.data;
            }.bind(this)
            )
        },
        onSubmit(){
               var the = this;
            this.sa.ajax("/buildManager/addHousesss",{
              
            "hname":the.formInline.hname,

                "cid":the.formInline.company.cid,

    "lid":the.formInline.landuse.lid,

     "oid":the.formInline.landowner.oid,

     "rid":the.formInline.roomtype.rid,

    "did":the.formInline.designpurpose.did,

    "zid":the.formInline.areas.areaid,

       "bid":the.formInline.buildingarea.bid,

     "lnid":the.formInline.landnumber.lnid,

    "bsid":the.formInline.struct.bsid,

    "gid":the.formInline.Method.gid,

    "location":the.formInline.location,
      "housestatusid":the.formInline.status.housestatusid

    // " housedrawing":the.formInline
              
           },
            function(data){
             if(data.data!=0){
                 var tab = {id: 'buildList', name: '添加楼盘', view: () => import('@/sa-view/WmtbuildManager/buildList.vue'), };
            this.sa_admin.showTab(tab);
             }
            }.bind(this)
            )
        },
        showAllArea(){
            var the = this;
            this.sa.ajax("/total/findAllArea",
           null,
            function(data){
                the.formInline.areas = data.data;
            }.bind(this)
            )
        }
    }

}

</script>
<style scoped>
.login{
  width: 600px;
  height: 900px;
  /* 把元素变成定位元素 */
  position: absolute;
  /* 元素距离上，左都为50% */
  left: 50%;
  top: 25%;
  /* 让元素的左外边距，上外边距为元素宽高的1/2 注意margin是负距*/
  margin-top: -150px;
  margin-left: -200px;
  text-align: center
}
</style>
